megamitenseifandomcom_es-20200214-history
Módulo:Gamebox
local getArgs = require('Module:Arguments').getArgs local getGames = require('Module:Gamedata') local p = {} local function makeInvokeFunction(funcName) -- makes a function that can be returned from #invoke, using -- Module:Arguments. return function (frame) local args = getArgs(frame, {parentOnly = true}) return pfuncName(args) end end local stylet = '\n|-\n|style="font-size:100%; text-align:center;background:#222;" colspan=2|' local function cate(catename,sort) if not mw.title.getCurrentTitle():inNamespace('') then return '' end if sort then sort = '|' .. sort else sort = '' end return 'Category:' .. catename .. sort .. '' end local t = { 'image'={'image'}, 'image_width'={'image_width',default='240px'}, 'image_bg'={'image_bg'}, 'japan'={'japan'}, 'romaji'={'romaji'}, 'Revelador'={'developer'}, 'Editor'={'publisher'}, 'Género'={'genre'}, 'Consola(s)'={'platform(s)','platform'}, 'Japón'={'release-date-japan','releasej'}, Estados Unidos'={'release-date-north-america','releasena'}, 'Europa' ={'release-date-europe','releaseeu'}, 'Australia'={'release-date-australasia','releaseau'}, 'cname'={'name',default=mw.title.getCurrentTitle().text}, -- Character's name y Titulos'={'aka'}, Japonés'={'japan','kana'}, 'Romaji'={'romaji'}, 'rpname'={'RPname','rpname',h='Revelations Name'}, 'Debut'={'debut','first'}, 'Afiliación'={'affiliation'}, 'Alineación'={'alignment'}, 'Equipo'={'team'}, -- Strange Journey 'Occupación'={'job','occupation'}, 'Rango'={'rank'}, -- Strange Journey 'Barco'={'ship'}, -- Strange Journey 'País'={'country'}, -- Strange Journey 'Razón'={'reason'}, -- Nocturne Demoníaco'={'demonic sponsor','sponsor'}, -- Nocturne 'Origen'={'origin'}, 'Arma'={'weapon'}, Demonio'={'demonpartner'}, -- Devil Child 'Tribu'={'tribe'}, -- DDSaga de Pistola'={'gun'}, de Atma'={'avatar'}, -- DDSaga Atma Avatar de Atma'={'brand'}, -- DDSaga Atma brand de la Marca'={'location'}, -- DDSaga Atma brand location de Nacimiento'={'birthday','dob'}, 'Edad'={'age'}, 'Zodíaco'={'zodiac'}, 'Altura'={'height'}, 'Peso'={'weight'}, de COMP'={'comp'}, -- Devil Survivor 1 character's COMP color del Teléfono Celular'={'cell'}, -- Devil Survivor 2 character's cel phone color 'Residencia'={'home'}, Aliado'={'allieddemon'}, -- General-purposed, primarily for Shin Megami Tensei IV Final de Fate'={'fatedemon'}, -- Demon fusions unlocked by raising Devil Survivor 2 character's Fate rank de Anime'={'animedemon'}, -- Allied demons summoned in Devil Survivor 2 anime de Sangre'={'blood','blood type'}, Cuerpo a Cuerpo'={'melee'}, a Distancia'={'ranged'}, 'Arcana'={'arcana'}, -- Persona series 'Arcana2'={'arcana2',h='Secondary Arcana'}, -- Persona 1 and 2 'Persona'={'persona'}, -- Character's signature Persona(s) 'Clase'={'class'}, -- SMTxFE de Mirage'={'miragepartner'}, -- SMTxFE Musical'={'theme','song'}, -- Character's theme music 'Gustos'={'likes'}, 'Disgustos'={'dislikes'}, 'Nacionalidad'={'nationality','nation'}, 'Etnicidad'={'ethnicity','ethnic'}, de Voz en Japonés'={'jva','JVA'}, de Voz en Íngles'={'iva','IVA'}, } local game_stat_order1 = { 'Revelador', 'Editor', 'Género', 'Consola(s)', } local game_stat_order2 = { 'Japón', 'los Estados Unidos', 'Europa', 'Australia', } local char_stat_order = { 'Apodos y Titulos', 'Nombre Japonés', 'Romaji', 'rpname', 'Debut', 'Nacionalidad', 'Etnicidad', 'Afiliación', 'Alineación', 'Equipo', 'Occupación', 'Rango', 'Barco', 'País', 'Razón', 'Patrocinador Demoníaco', 'Origen', 'Arma', 'Compañero Demonio', 'Tribu', 'Tipo de Pistola', 'Avatar de Atma', 'Marca de Atma', 'Ubicación de la Marca', 'Fecha de Nacimiento', 'Edad', 'Zodíaco', 'Altura', 'Peso', 'Color de COMP', 'Color de Teléfono Celular', 'Residencia', 'Demonio Aliado', 'Demonio de Fate', 'Demonio de Anime', 'Tipo de Sangre', 'Arma Cuerpo a Cuerpo', 'Arma a Distancia', 'Arcana', 'Arcana2', 'Persona', 'Clase', 'Compañero de Mirage', 'Tema Musical', 'Gustos', 'Disgustos', 'Actor de Voz en Japonés', 'Actor de Voz en Íngles', } local function get_prop(args) local prop = {} for k, v in pairs(t) do for _, name in ipairs(v) do if argsname then propk = argsname break end end propk = propk or v.default end return prop end p.game = makeInvokeFunction('_game') function p._game(args) local prop = get_prop(args) local game = args1 or args.class or args.game or args.Game or '' local gameg -- Game general style if getGames.gamesgame.fallback then gameg = getGames.gamesgame.fallback -- e.g. 'p3f' and 'p3p' will fall back to 'p3' if applicable. else gameg = game end local gamen = getGames.gamesgame.name -- Full game name local gamegn = getGames.gamesgameg.name -- e.g. 'Persona 3 FES' will fall back to 'Persona 3' if applicable. if not prop.image_bg then prop.image_bg = '#333' end local styleg = '\n|-\n!style="background: ' .. getGames.gamesgameg.colorbg .. ';color: ' .. getGames.gamesgameg.font .. '"' local styleh = styleg .. '|' local stylec = styleg .. ' colspan=2|' local result if prop.image then prop.image = '\n|-\n| style="border-radius:3.5px; background:' .. prop.image_bg .. '" colspan="2" align="center" | ' else prop.image = '' end result = ' ' .. cate('Games') if gameg 'mt1' or gameg 'mt2' then result = result .. cate('Megami Tensei Series') elseif gameg 'smt1' or gameg 'smt2' or gameg 'smtif' or gameg 'smt3' or gameg 'smt9' or gameg 'smtim' or gameg 'smtsj' or gameg 'smt4' then result = result .. cate('Shin Megami Tensei Series') elseif gameg 'lb1' or gameg 'lb2' or gameg 'alb' or gameg 'lb3' or gameg 'lbs' or gameg 'lbnt1' or gameg 'lbnt2' or gameg 'lbnt3' then result = result .. cate('Last Bible Series') elseif gameg 'majin1' or gameg 'majin2' then result = result .. cate('Majin Tensei Series') elseif gameg 'smtds' or gameg 'sh' or gameg 'raidou1' or gameg 'raidou2' then result = result .. cate('Devil Summoner') elseif gameg 'p1' or gameg 'p2is' or gameg 'p2ep' or gameg 'p3' or gameg 'pts' or gameg 'p4' or gameg 'pq' or gameg 'pq2' or gameg 'p5' then result = result .. cate('Persona Series') elseif gameg 'childred' or gameg 'childblack' or gameg 'childwhite' or gameg 'childlight' or gameg 'childfire' or gameg 'childice' or gameg 'childmessiah' then result = result .. cate('Devil Children') elseif gameg 'ddsaga1' or gameg 'ddsaga2' then result = result .. cate('Digital Devil Saga') elseif gameg 'desu1' or gameg 'desu2' then result = result .. cate('Devil Survivor Series') end if gameg 'childred' or gameg 'childblack' then result = result .. cate('Devil Children Red/Black Book','!') elseif gameg 'childmessiah' then result = result .. cate('Messiah Riser','!') elseif gameg '' then elseif gameg then result = result .. cate(gamen,'!') end return result end p.char = makeInvokeFunction('_char') function p._char(args) local prop = get_prop(args) local game = args1 or args.class or args.game or args.Game or '' local gameg if getGames.gamesgame.fallback then gameg = getGames.gamesgame.fallback else gameg = game end local gamen = getGames.gamesgame.name local gamegn = getGames.gamesgameg.name local styleg = '\n|-\n!style="background: ' .. getGames.gamesgameg.colorbg .. ';color: ' .. getGames.gamesgameg.font .. '"' local styleh = styleg .. '|' local stylec = styleg .. ' colspan=2|' local result = '{| class="customtable" style="background:#000; border: 3px ' .. getGames.gamesgameg.colorb .. ' solid; float: right; border-radius:7px; font-size:90%; padding: 0px; width:290px; margin-left:10px"' .. stylec .. prop.cname if not prop.image_bg then prop.image_bg = 'linear-gradient(20deg, #bbb, #222)' end if prop.image then result = result .. '\n|-\n!colspan=2 style="background:' .. prop.image_bg .. '"|' .. prop.image end for i,v in ipairs(char_stat_order) do if propv then if tv.h then t.header = tv.h else t.header = v end result = result .. styleh .. t.header .. '\n|' .. propv end end return p -- end